/// <reference types="vitest" />
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
import eslint from "vite-plugin-eslint";

const eslintOptions = {
  fix: true,
  cache: false,
};

export default defineConfig({
  plugins: [vue(), eslint(eslintOptions), vueJsx()],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
  server: {
    // proxy: {
    //   "/api/file/upload": {
    //     target: "http://119.91.145.64:8081",
    //     changeOrigin: true,
    //   },
    //   "/api": {
    //     target: "http://10.1.10.229:5051",
    //     // target: "http://119.91.145.64:8085",
    //     changeOrigin: true,
    //   },
    //   "/rtc": {
    //     target: "http://119.91.145.64:1985",
    //     changeOrigin: true,
    //   },
    // },
    proxy: {
      "/api/file/upload": {
        target: "http://127.0.0.1:8080",
        changeOrigin: true,
      },
      "/api": {
        target: "http://127.0.0.1:8080",
        // target: "http://119.91.145.64:8085",
        changeOrigin: true,
      },
      "/rtc": {
        target: "http://127.0.0.1:1985",
        changeOrigin: true,
      },
    },
  },
  test: {
    environment: "jsdom",
  },
});
